<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/layuimini/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuimini/css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <form class="layui-form layui-form-pane" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">公众号名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="mp_name" lay-verify="required" placeholder="请输入" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">公众号账号</label>
                <div class="layui-input-inline">
                    <input type="text" name="mp_user" lay-verify="required" placeholder="请输入" autocomplete="off"
                           class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">appid</label>
                <div class="layui-input-inline">
                    <input type="text" name="appid" lay-verify="required" placeholder="请输入" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">appsecret</label>
                <div class="layui-input-inline">
                    <input type="text" name="appsecret" lay-verify="required" placeholder="请输入" autocomplete="off"
                           class="layui-input">
                </div>
            </div>


            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>

        </form>
    </div>
</div>
<script src="/static/layuimini/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>

<script>
    layui.use(['form', 'util', 'layer', 'table'], function () {
        var table = layui.table;
        var layer = layui.layer;
        var form = layui.form;
        var $ = layui.jquery;

        //监听提交
        form.on('submit(demo1)', function (data) {
            $.ajax({
                type: "post",
                url: "",
                data: data.field,
                dataType: "json",
                success: function (data) {
                    if (data.code == 1) {
                        //关闭iframe
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.msg(data.msg, {icon: 6, time: 4000});

                        parent.layer.close(index);//再执行关闭


                    } else {
                        //关闭iframe
                        //   var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        // parent.layer.msg(data.msg, {icon: 6,time: 4000});

                        // parent.layer.close(index);//再执行关闭
                    }
                }


            });
            return false;
        });


    });
</script>
</body>

</html>